﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class IHttpModule_HttpModules_demoExceptionModule : System.Web.UI.Page
{
    protected void Page_Error(object sender, EventArgs e)
    {
        string ErrString = string.Empty;
       Exception objErr = Server.GetLastError().GetBaseException();
       ErrString += DateTime.Now.ToString() + "<br/>";
       ErrString += "<b>Error Caught in Page_Error event</b><hr><br>" +
               "<br><b>Error in: </b>" + Request.Url.ToString() +
                "<br><b>Error Message: </b>" + objErr.Message.ToString() +
               "<br><b>Stack Trace:</b><br>" +
                         objErr.StackTrace.ToString();
       Server.ClearError();
       //Response.Write(ErrString);

       lb.Text = ErrString;
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    protected void btn_Click(object sender, EventArgs e)
    {
        throw new Exception("Test ExceptionModule");
    }
}
